﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ViewRosters.aspx.vb" Inherits="TWIN_test.ViewRoster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Workshop Roster</title>
</head>
<body background="/Images/Training-Instructor-Background.gif"> 
    <form id="form1" runat="server">
   <center><div>
         <strong><h1><font color="white">Workshop Members</font></h1>
            <h2 style="height: 26px"> 
                <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource2" 
                    ForeColor="White">
                    <EditItemTemplate>
                        TITLE:
                        <asp:TextBox ID="TITLETextBox" runat="server" Text='<%# Bind("TITLE") %>' />
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Update" />
                        &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                            CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        TITLE:
                        <asp:TextBox ID="TITLETextBox" runat="server" Text='<%# Bind("TITLE") %>' />
                        <br />
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                            CommandName="Insert" Text="Insert" />
                        &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                            CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        TITLE:
                        <asp:Label ID="TITLELabel" runat="server" Text='<%# Bind("TITLE") %>' />
                        <br />

                    </ItemTemplate>
                </asp:FormView>
         </h2>
         </p>
         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
             AutoGenerateDeleteButton="True" AutoGenerateSelectButton="True" 
             Caption="Click Select to Pass/Fail" CellPadding="3" CellSpacing="2" 
             DataSourceID="SqlDataSource1">
             <Columns>
                 <asp:BoundField DataField="USERNAME" HeaderText="USERNAME" 
                     SortExpression="USERNAME" />
                 <asp:BoundField DataField="FIRSTNAME" HeaderText="FIRSTNAME" 
                     SortExpression="FIRSTNAME" />
                 <asp:BoundField DataField="LASTNAME" HeaderText="LASTNAME" 
                     SortExpression="LASTNAME" />
                 <asp:BoundField DataField="PASSED" HeaderText="PASSED" 
                     SortExpression="PASSED" />
             </Columns>
         </asp:GridView>
         </strong><br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>" 
            
             SelectCommand="SELECT DISTINCT WORKSHOPS_TAKEN.USERNAME, INFO.FIRSTNAME, INFO.LASTNAME, WORKSHOPS_TAKEN.PASSED FROM WORKSHOPS_TAKEN, INFO WHERE WORKSHOPS_TAKEN.USERNAME = INFO.USERNAME AND (WORKSHOPS_TAKEN.WORKSHOP_ID = :WORKSHOP_ID)"
             DeleteCommand="DELETE FROM WORKSHOPS_TAKEN WHERE USERNAME = :username"
             UpdateCommand="UPDATE WORKSHOPS_TAKEN SET PASSED = :grade WHERE USERNAME = :username"
             >
             
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="1" Name="WORKSHOP_ID" 
                    QueryStringField="id" Type="Decimal" />
            </SelectParameters>
            <UpdateParameters>
            <asp:Parameter Name = "username" Type = "String" />
            <asp:Parameter Name = "grade" Type = "String" />
            </UpdateParameters>
            <DeleteParameters>
            <asp:Parameter Name = "username" Type = "String" />
            </DeleteParameters>
        </asp:SqlDataSource>

         <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
             ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>" 
             DataSourceMode="DataReader" 
             ProviderName="<%$ ConnectionStrings:ConnectionString2.ProviderName %>" 
             SelectCommand="SELECT &quot;TITLE&quot; FROM &quot;WORKSHOP&quot; WHERE (&quot;ID&quot; = :ID)">
             <SelectParameters>
                 <asp:QueryStringParameter DefaultValue="1" Name="ID" QueryStringField="id" 
                     Type="Decimal" />
             </SelectParameters>
         </asp:SqlDataSource>
        <br />

        <asp:Button ID="backButton" runat="server" Text="Back" />

    </center></div>
    </form>
</body>
</html>
